﻿import QtQuick 2.4
import QtQuick.Layouts 1.1
import QtQuick.Window 2.0
Item{
    id:greenShie
    anchors.top: parent.top
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.topMargin: 7
    anchors.leftMargin: 12
    anchors.rightMargin: 12
//    width:600 -10
//    height: 400
    width:  Screen.width/3
    height: protectionPopUp.height
    Rectangle
    {
        anchors.fill: parent
        //        color: "red"
        color:app.getSystemThemeColor()
        //    width: parent.width - anchors.leftMargin - anchors.rightMargin
        APPCloseMenu{
            anchors.top: parent.top
            anchors.topMargin: 16
            width: 20
            height: 20
            anchors.right: parent.right
            anchors.rightMargin: 16
            onClose:{

                greenShieldItem.visible = false
            }
        }

        Text{
            id: title
            width: parent.width
            height: 30
            color: "#FFFFFF"
            font.pixelSize: 26
            anchors.top: parent.top
            anchors.topMargin: 20
                            //horizontalAlignment : Text.AlignHCenter
		 anchors.left: parent.left
		 anchors.leftMargin:8
            font.family: "黑体"
        }

        Rectangle{
            id: separator
            width: parent.width
            height: 1
            color: "#FFF"
            anchors.top: title.bottom
        }

        Row{
            id: colInfo
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter : parent.verticalCenter
            anchors.top: separator.bottom
            anchors.topMargin: 10
            anchors.left: parent.left
            anchors.leftMargin: houLayout.visible?4:0
            anchors.bottom: parent.bottom
            spacing: 4

            width: parent.width
            ColumnLayout
            {
                anchors.centerIn: parent.Center
                id:zhengdunqian
                spacing: 8
                Image
                {
                    id: imgInfo1
//                    width: greenShie.width/2 -6
//                    height: greenShie.height -60
                    Layout.preferredWidth:houLayout.visible? greenShie.width/2 -6 :greenShie.width
                    Layout.preferredHeight: greenShie.height -100
                    source: "../../../../docdata/natureprotection/images/新乡黄河湿地点位1_1.jpg"
                }

                Text{
                    id:cityInfo
                    text:"整顿前"
                    font.pixelSize: 18
                    color:"white"
                    font.family: "微软雅黑"
                    Layout.alignment: Qt.AlignCenter
                }
            }
            ColumnLayout
            {
                id:houLayout
                spacing: 8
                Image
                {
                    id: imgInfo2
                    Layout.preferredWidth: greenShie.width/2 -6
                    Layout.preferredHeight: greenShie.height -100
                    source: "../../../../docdata/natureprotection/images/新乡黄河湿地点位1_1.jpg"
                }
                Text{
                    id:cityInfo02
                    text:"整顿后"
                    font.pixelSize: 18
                    color:"white"
                    font.family: "微软雅黑"
                    Layout.alignment: Qt.AlignCenter
                }
            }


        }

    }
//        Component.onCompleted:
//        {
//            greenShieldItem.visible = true
//            title.text =  "新乡黄河湿地点位"
//            imgInfo1.source="../../../../docdata/natureprotection/images/新乡黄河湿地点位1_1.jpg"
//            imgInfo2.source="../../../../docdata/natureprotection/images/新乡黄河湿地点位1_2.jpg"
//        }

        Connections
        {
            target:app
            onSignalShowGreenShield:
            {
                var u_t = JSON.parse(str)

                greenShieldItem.visible = true
                title.text =  u_t.name
                imgInfo1.source= "file:///" +u_t.image1;
                if(u_t.image2.length <=0)
                {
                    houLayout.visible  =false
                    cityInfo.text = "整顿现状"
                }else
                {
                    houLayout.visible  = true
                    cityInfo.text = "整顿前"
                    imgInfo2.source= "file:///" +u_t.image2;
                }
            }
        }

}



